﻿<UserControl x:Class="WPFXMPPClient.MapUserControl"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Loaded="Window_Loaded" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" >
    <UserControl.Resources>
        <DataTemplate x:Key="GeoLocTemplate">
            <Grid Background="{x:Null}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="44" />
                    <ColumnDefinition Width="300*" />
                    <ColumnDefinition Width="33" />
                    <ColumnDefinition Width="33" />
                    <ColumnDefinition Width="33" />
                </Grid.ColumnDefinitions>

                <Grid.RowDefinitions>
                    <RowDefinition Height="44" />
                    <RowDefinition Height="20" />
                </Grid.RowDefinitions>

                <Rectangle Stroke="Black" StrokeThickness="1" Fill="{Binding Presence.PresenceBrush}"  Width="44" Height="44" Grid.Column="0" Grid.Row="0" />
                <Image Grid.Column="0" Grid.Row="0" Width="36" Height="36" Source="{Binding Avatar}" />


                <Button Background="#AAEEFFEE" BorderBrush="{x:Null}" Margin="10,0" Grid.Column="1" Grid.Row="0" 
                             HorizontalAlignment="Stretch" VerticalContentAlignment="Center" 
                             x:Name="HyperlinkRosterItem" Click="HyperlinkRosterItem_Click" 
                             FontSize="16" FontWeight="Bold" HorizontalContentAlignment="Stretch" Content="{Binding Name}">
                </Button>


                <Button BorderThickness="0" BorderBrush="{x:Null}" HorizontalAlignment="Stretch" ToolTip="View New Messages" Grid.Row="0" Grid.Column="2" x:Name="ButtonViewMessages" Click="ButtonViewMessages_Click"   HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Visibility="{Binding NewMessagesVisible}" >
                    <Button.Background>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#EE4444FF" Offset="0"/>
                            <GradientStop Color="#EECCCCFF" Offset=".5"/>
                            <GradientStop Color="#EE4444FF" Offset="1"/>
                        </LinearGradientBrush>
                    </Button.Background>

                    <Image  Source="Images/mail.png" Width="20" Height="20" />
                </Button>

                <!-- Create and use the globe.png image instead of the more.png image -->
                <!--<Button Background="#AAEEFFEE" BorderBrush="{x:Null}" HorizontalAlignment="Stretch" ToolTip="View on Map" Grid.Row="0" Grid.Column="3" x:Name="ButtonViewOnMap" Click="ButtonViewOnMap_Click"  HorizontalContentAlignment="Center" VerticalContentAlignment="Center" >
                    <Image  Source="Images/more.png" Width="20" Height="20" />
                </Button>-->

                <!--<Button Background="#AAEEFFEE" BorderBrush="{x:Null}" HorizontalAlignment="Stretch" ToolTip="Start an Audio Call" Grid.Row="0" Grid.Column="4" x:Name="ButtonStartAudioCall" Click="ButtonStartAudioCall_Click"   HorizontalContentAlignment="Center" VerticalContentAlignment="Center" >
                    <Image  Source="Images/volume.png" Width="20" Height="20" />
                </Button>-->

                <!--<s:ElementMenu>
                        <s:ElementMenuItem x:Name="MenuItemQuery" Click="MenuItemQuery_Click">Query</s:ElementMenuItem>
                    </s:ElementMenu>-->
                <StackPanel Grid.Row="1" Grid.Column="0"  Grid.ColumnSpan="5" Orientation="Horizontal">
                    <TextBlock Margin="5,0" Text="{Binding Path=Presence.PresenceType}" />
                    <TextBlock Margin="5,0" Text="{Binding Path=Presence.Status}" />
                    <TextBlock Margin="5,0" Text="{Binding GeoString}"  />
                </StackPanel>
            </Grid>

        </DataTemplate>
    </UserControl.Resources>
    
    <Grid Background="Transparent" x:Name="GridMain" >
        <Grid.RowDefinitions>
            <RowDefinition Height="*" /> <!-- Row 0: Options -->
            <RowDefinition Height="Auto" />    <!-- Row 1: Real-time Stats  -->
           
        </Grid.RowDefinitions>
        
        <StackPanel Visibility="Collapsed" Orientation="Horizontal">
            <TextBox x:Name="TextBoxURL" Text="http://www.yahoo.com"></TextBox>
            <Button Click="ButtonLoadURL_Click" x:Name="ButtonLoadURL" Width="Auto">Load URL</Button>         
        </StackPanel>

            
         <Grid Visibility="Visible" Margin="5,5,5,5" Grid.Row="1" x:Name="GridOptions" > <!-- Options Grid -->
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition> <!-- Map Type-->
                <RowDefinition Height="Auto"></RowDefinition> <!-- Zoom -->
                <RowDefinition Height="Auto"></RowDefinition> <!-- Size -->
                <RowDefinition Height="Auto"></RowDefinition> <!-- Scale -->
                <RowDefinition Height="Auto"></RowDefinition> <!-- Timestamp -->
                <RowDefinition Height="Auto"></RowDefinition> <!-- Coordinates -->
                <RowDefinition Height="Auto"></RowDefinition> <!-- Update -->
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"></ColumnDefinition>
                <ColumnDefinition Width="Auto"></ColumnDefinition>
                <ColumnDefinition Width="Auto"></ColumnDefinition>
                <ColumnDefinition Width="*"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            
                <!--<Expander Header="Location History">
                
                    <ListView x:Name="LocationsList">
                
                    </ListView>
                </Expander>-->

          
            
                <Button Visibility="Collapsed" Grid.Column="2" HorizontalAlignment="Right" x:Name="ButtonLoadLocation" Click="ButtonLoadLocation_Click" Width="Auto">Refresh</Button>
                <Button Visibility="Collapsed" Grid.Column="3" HorizontalAlignment="Right" x:Name="ButtonLoadLocationAll" Click="ButtonLoadLocationAll_Click" Width="Auto" Margin="0,0,65,0">Load All</Button>

           
           
                     <!--<StackPanel Margin="5,5,5,5"  Visibility="Visible" Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Bottom">-->
                    <Label Margin="3,3,3,3" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="0" FontWeight="Bold" VerticalAlignment="Center">Map Type</Label>
                    <ComboBox Margin="3,3,3,3" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" x:Name="ComboBoxMapType" Width="100" Height="25" />

                    <Label Margin="3,3,3,3" Grid.Row="0" Grid.Column="2" HorizontalAlignment="Left" FontWeight="Bold"  VerticalAlignment="Center">Zoom</Label>
                    <ComboBox Margin="3,3,0,3" Grid.Column="3" HorizontalAlignment="Left" VerticalAlignment="Center" x:Name="ComboBoxZoom" ItemsSource="{Binding}" Width="50" Height="25"/>

                    <Label VerticalAlignment="Center" Margin="3,3,3,3" HorizontalAlignment="Left" Grid.Row="1" Grid.Column="0" FontWeight="Bold">Size</Label>
                    <StackPanel Margin="3,3,3,3" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" Orientation="Horizontal">
                        <TextBox  Width="70" x:Name="TextBoxSizeHorizontal" ></TextBox>
                        <Label FontWeight="Bold" >x</Label>
                        <TextBox Width="70" x:Name="TextBoxSizeVertical" ></TextBox>
                        <Label FontWeight="Regular" >Pixels</Label>
                    </StackPanel>

                    <Label Margin="3,3,3,3" Grid.Row="1" Grid.Column="2" HorizontalAlignment="Left" FontWeight="Bold"  VerticalAlignment="Center">Scale</Label>
                    <ComboBox Margin="3,3,0,3" Grid.Row="1" Grid.Column="3" HorizontalAlignment="Left" VerticalAlignment="Center" x:Name="ComboBoxScale" ItemsSource="{Binding}" Width="50" Height="25"/>


                    <!--<StackPanel Grid.Row="1" Grid.ColumnSpan="4" Orientation="Horizontal" HorizontalAlignment="Stretch">-->

 
                    <!--</StackPanel>-->

                    <Label Margin="3,3,3,3" Grid.Column="0" Grid.Row="2" FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Center">Timestamp</Label>
                    <TextBlock Margin="3,3,3,3" Grid.Column="1" Grid.Row="2" x:Name="TextBoxTimeStamp" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock>
                    <Label Margin="3,3,3,3" Grid.Column="2" Grid.Row="2" FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Center">Coordinates</Label>
                    <TextBlock Margin="3,3,0,3" Grid.Column="3" Grid.Row="2" x:Name="TextBoxGeoLoc" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock>

                    <Button Grid.Row="3" Grid.Column="4" Margin="0,0,6,6" VerticalAlignment="Center" x:Name="ButtonUpdate" HorizontalAlignment="Right" Click="ButtonUpdate_Click" Height="25">Update</Button>
                       
            <!--</StackPanel>-->
        </Grid>

        <Image Grid.Row="0" x:Name="MapImage" Margin="3,3,3,3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MinHeight="400" MinWidth="400"/>
        
        <Grid Visibility="Collapsed" Grid.Row="2" Margin="5,5,5,5">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
               
            </Grid.RowDefinitions>
       
            <WebBrowser Visibility="Collapsed" Grid.Row="0" x:Name="WebBrowserMap" Margin="0,0,0,0"></WebBrowser>
          
            <Grid Visibility="Collapsed" Margin="5,5,5,5" Grid.Row="2" DataContext="{Binding ElementName=OurRosterItem}">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                </Grid.RowDefinitions>
                <StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Right" Visibility="Collapsed">              
                    <Button Margin="10,0" x:Name="ButtonClearKML" Click="ButtonClearKML_Click">Clear</Button>
                    <Button Margin="10,0" x:Name="ButtonSaveKML" Click="ButtonSaveKML_Click">Save KML</Button>
                </StackPanel>
                
                <StackPanel Grid.Row="0" Orientation="Horizontal" Visibility="Collapsed">
                    <Label>Last location received at:</Label>
                    <TextBlock x:Name="TextBlockLastLocationTimestamp" Text="{Binding OurRosterItem.GeoLoc.TimeStamp}"></TextBlock>
                </StackPanel>
            </Grid>
        </Grid>
    </Grid>
</UserControl>
